<{if $event}>
<{include file="db:eguide_event.html"}>
<{/if}>
<div class="event">
<h2><{$lang_event_edit}></h2>
<!-- for DHTML calendar -->
<link rel="stylesheet" type="text/css" media="all" href="<{$xoops_url}>/include/calendar-blue.css" />
<script type="text/javascript" src="<{$xoops_url}>/include/calendar.js"></script>
<script type="text/javascript">
<!--
var calendar = null;

function selected(cal, date) {
  cal.sel.value = date;
}

function closeHandler(cal) {
  cal.hide();
  Calendar.removeEvent(document, "mousedown", checkCalendar);
}

function checkCalendar(ev) {
  var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
  for (; el != null; el = el.parentNode)
    if (el == calendar.element || el.tagName == "A") break;
  if (el == null) {
    calendar.callCloseHandler(); Calendar.stopEvent(ev);
  }
}
function showCalendar(id) {
  var el = xoopsGetElementById(id);
  if (calendar != null) {
    calendar.hide();
  } else {
    var cal = new Calendar(<{if $smarty.const._MD_CAL_MONDAY_FIRST}>true<{else}>false<{/if}>, <{if $jstime}><{$jstime}><{else}>'null'<{/if}>, selected, closeHandler);
    calendar = cal;
    cal.setRange(<{$calrange[0]}>, <{$calrange[1]}>);
    calendar.create();
  }
  calendar.sel = el;
  calendar.parseDate(el.value);
  calendar.showAtElement(el);
  Calendar.addEvent(document, "mousedown", checkCalendar);
  return false;
}

Calendar._DN = new Array
<{if $weekname}>
("<{$weekname.Sun}>", "<{$weekname.Mon}>", "<{$weekname.Tue}>",
 "<{$weekname.Wed}>", "<{$weekname.Thu}>", "<{$weekname.Fri}>",
 "<{$weekname.Sat}>", "<{$weekname.Sun}>");
<{else}>
("Sun", "Mon", "Tue", "Wed", "Thu", "Fri","Sat", "Sun");
<{/if}>

Calendar._MN = new Array
<{if $monthname}>
(<{foreach from=$monthname item=month}>"<{$month}>",<{/foreach}>"");
<{else}>
("Jan", "Feb", "Mar", "Apr", "May", "Jun",
 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
<{/if}>

Calendar._TT = {};
<{if $calsetting}>
Calendar._TT["TOGGLE"] = "<{$calsetting._CAL_TGL1STD}>";
Calendar._TT["PREV_YEAR"] = "<{$calsetting._CAL_PREVYR}>";
Calendar._TT["PREV_MONTH"] = "<{$calsetting._CAL_PREVMNTH}>";
Calendar._TT["GO_TODAY"] = "<{$calsetting._CAL_GOTODAY}>";
Calendar._TT["NEXT_MONTH"] = "<{$calsetting._CAL_NXTMNTH}>";
Calendar._TT["NEXT_YEAR"] = "<{$calsetting._CAL_NEXTYR}>";
Calendar._TT["SEL_DATE"] = "<{$calsetting._CAL_SELDATE}>";
Calendar._TT["DRAG_TO_MOVE"] = "<{$calsetting._CAL_DRAGMOVE}>";
Calendar._TT["PART_TODAY"] = "(<{$calsetting._CAL_TODAY}>)";
Calendar._TT["MON_FIRST"] = "<{$calsetting._CAL_DISPM1ST}>";
Calendar._TT["SUN_FIRST"] = "<{$calsetting._CAL_DISPS1ST}>";
Calendar._TT["CLOSE"] = "<{$calsetting._CLOSE}>";
Calendar._TT["TODAY"] = "<{$calsetting._CAL_TODAY}>";
<{else}>
Calendar._TT["TOGGLE"] = "<{$smarty.const._CAL_TGL1STD}>";
Calendar._TT["PREV_YEAR"] = "<{$smarty.const._CAL_PREVYR}>";
Calendar._TT["PREV_MONTH"] = "<{$smarty.const._CAL_PREVMNTH}>";
Calendar._TT["GO_TODAY"] = "<{$smarty.const._CAL_GOTODAY}>";
Calendar._TT["NEXT_MONTH"] = "<{$smarty.const._CAL_NXTMNTH}>";
Calendar._TT["NEXT_YEAR"] = "<{$smarty.const._CAL_NEXTYR}>";
Calendar._TT["SEL_DATE"] = "<{$smarty.const._CAL_SELDATE}>";
Calendar._TT["DRAG_TO_MOVE"] = "<{$smarty.const._CAL_DRAGMOVE}>";
Calendar._TT["PART_TODAY"] = "(<{$smarty.const._CAL_TODAY}>)";
Calendar._TT["MON_FIRST"] = "<{$smarty.const._CAL_DISPM1ST}>";
Calendar._TT["SUN_FIRST"] = "<{$smarty.const._CAL_DISPS1ST}>";
Calendar._TT["CLOSE"] = "<{$smarty.const._CLOSE}>";
Calendar._TT["TODAY"] = "<{$smarty.const._CAL_TODAY}>";
<{/if}>

// date formats
Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd";
Calendar._TT["TT_DATE_FORMAT"] = "y-mm-dd";

Calendar._TT["WK"] = "";
//-->
</script>

<form action="admin.php<{if $eid}>?eid=<{$eid}><{/if}>" method="post" class="evbody" name="evform" id="evform" onsubmit="return xoopsFormValidate_evform();">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td>
<h3><{$smarty.const._MD_TITLE}></h3>
<input type="text" name="title" id="title" value="<{$title}>" size="60" maxlength="80" />
</td><{if $input_category}><td>
<h3><{$smarty.const._MD_EVENT_CATEGORY}></h3>
<{$input_category}></td><{/if}></tr>
</table>
<h3><{$smarty.const._MD_EVENT_DATE}></h3>
<p>
<{$input_edate}> &nbsp;
<{$smarty.const._MD_TIMEC}> 
<{if $timetable}>
  <select name="edatetime">
    <{foreach item=timeopt from=$timetable}>
      <option value="<{$timeopt.value}>"<{if $timeopt.value==$edatetime}> selected="selected"<{/if}>><{$timeopt.label}></option>
    <{/foreach}>
  </select>
<{else}>
  <{$input_edatetime}>
<{/if}>
</p>
<fieldset>
  <legend>
<script type="text/javascript">
<{if $extent_sets || $edata.closetime!=3600 }>
document.write('<input type="checkbox" onClick="toggle(\'exdate\',this);" checked="checked" id="dateck"/>');
<{else}>
document.write('<input type="checkbox" onClick="toggle(\'exdate\',this);" id="dateck"/>');
<{/if}>
</script>
  <{$smarty.const._MD_EDIT_EXTENT}>
  </legend>
  <div id="exdate">
    <p><b><{$smarty.const._MD_EVENT_EXPIRE}></b> <{$input_expire}></p>
    <p><b><{$smarty.const._MD_CLOSEBEFORE}></b> <input type="text" name="before" id="before" size="7" value="<{$before}>"/> <span class="evinfo"><{$smarty.const._MD_CLOSEBEFORE_DESC}></span></p>
    <{if $input_extent}>
    <p>
      <b><{$smarty.const._MD_EVENT_EXTENT}></b> <{$input_extent}>
    <{if $extent_sets}>
    <div class="extents">
    <{foreach from=$extent_sets item=ext}>
      <nobr><{if $ext.disable}>&middot; <{else}><input type="checkbox" value="<{$ext.exdate}>" name="extent_sets[<{$ext.no}>]"<{if $ext.checked}> checked<{/if}>/><{/if}><{$ext.date}></nobr>
    <{/foreach}>
    </div>
    <{/if}>
    </p>
    <{/if}>
  </div>
</fieldset>
<h3><{$smarty.const._MD_INTROTEXT}></h3>
<{if $use_fckeditor}>
<textarea id="summary" name="summary" wrap="virtual" cols="60" rows="10"><{$summary|escape}></textarea>
<{else}>
<{$summary_textarea}>
<{/if}>
<h3><{$smarty.const._MD_EXTEXT}></h3>
<textarea name="body" wrap="virtual" cols="60" rows="10"><{$body}></textarea>

<{if $use_fckeditor}>
<script type="text/javascript" src="<{$xoops_url}>/common/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
function fckeditor_exec(target, width, height, url) {
	var oFCKeditor = new FCKeditor(target, width, height, "<{$use_fckeditor}>");
	oFCKeditor.BasePath = "<{$xoops_url}>/common/fckeditor/";
	oFCKeditor.ReplaceTextarea();
}
fckeditor_exec("summary", "100%", "350");
fckeditor_exec("body", "100%", "350");
</script>
<input type="hidden" name="style" value="0" />
<{else}>
<h3><{$smarty.const._MD_EVENT_STYLE}></h3>
<{$input_style}>
<{/if}>

<h3><{$smarty.const._MD_RESERV_SETTING}></h3>
<div><input type="checkbox" name="reservation" value="1"<{if $reservation}> checked<{/if}>/> <{$smarty.const._MD_RESERV_DESC}></div>
<div>
  <input type="checkbox" name="strict" value="1"<{if $strict}> checked<{/if}>/> <{$smarty.const._MD_RESERV_STOPFULL}>
  <input type="checkbox" name="autoaccept" value="1"<{if $autoaccept}> checked<{/if}>/> <{$smarty.const._MD_RESERV_AUTO}>
</div>
<div><input type="checkbox" name="notify" value="1"<{if $notify}> checked<{/if}>/> <{$smarty.const._MD_RESERV_NOTIFYPOSTER}></div>
<div><b><{$smarty.const._MD_RESERV_PERSONS}></b> <input type="text" name="persons" value="<{$persons}>" size="3" /> <{$smarty.const._MD_RESERV_UNIT}></div>
<h3><{$smarty.const._MD_RESERV_ITEM}></h3>
<textarea name="optfield" wrap="virtual" cols="60" rows="5"><{$optfield}></textarea>
<div id="itemhelper" style="display:none;">
  <{$smarty.const._MD_RESERV_LAB}> <input name="xelab" size="10">
  <input type="checkbox" name="xereq" title="<{$smarty.const._MD_RESERV_REQ}>">
  <select name="xetype">
    <option value="text">text</option>
    <option value="checkbox">checkbox</option>
    <option value="radio">radio</option>
    <option value="textarea">textarea</option>
    <option value="select">select</option>
    <option value="hidden">hidden</option>
    <option value="const">const</option>
  </select>
  <input name="xeopt" size="30" />
  <button onClick="return addFieldItem();"><{$smarty.const._MD_RESERV_ADD}></button>
</div>
<div class="evinfo">
  <{$smarty.const._MD_RESERV_ITEM_DESC}> <{$label_desc}></div>
<fieldset>
  <legend>
<script type="text/javascript">
<{if $edata.optvars}>
document.write('<input type="checkbox" onClick="toggle(\'optvars\',this);" checked="checked" id="optck"/>');
<{else}>
document.write('<input type="checkbox" onClick="toggle(\'optvars\',this);" id="optck"/>');
<{/if}>
</script>
  <{$smarty.const._MD_OPTION_VARS}>
  </legend>
  <div id="optvars">
    <h3><{$smarty.const._MD_RESERV_REDIRECT}></h3>
    <input type="text" name="redirect" value="<{$optvars.redirect|escape}>" size="60" />
    <div class="evinfo"><{$smarty.const._MD_RESERV_REDIRECT_DESC}></div>
    
    <h3><{$smarty.const._MD_OPTION_OTHERS}></h3>
    <textarea name="opt_others" cols="60" rows="4"><{$opt_others|escape}></textarea>
  </div>
</fieldset>
<{if $input_status}>
<p><{$input_status}></p>
<{/if}>
<p>
<{if $eid && $enable_copy}>
<div><input type="checkbox" name="eid" value="0"><{$smarty.const._MD_NEWTITLE}></div>
<{/if}>
<input type="submit" name="preview" value="<{$smarty.const._MD_PREVIEW}>" />
<input type="submit" name="save" value="<{$smarty.const._MD_SAVE}>" />
</p>
</form>
<script type="text/javascript">
<!--//

// display only JavaScript enable
xoopsGetElementById("itemhelper").style.display = "block";
function addFieldItem() {
    var myform = window.document.evform;
    var item=myform.xelab.value;
    if (item == "") {
	alert("<{$smarty.const._MD_RESERV_LABREQ}>");
	myform.xelab.focus();
	return false;
    }
    if (myform.xereq.checked) item += '*';
    var ty = myform.xetype.value;
    var ov = myform.xeopt.value;
    item += ','+ty;
    if (ty != 'text' && ty != 'textarea' && ov == "") {
	alert(ty+": <{$smarty.const._MD_RESERV_OPTREQ}>");
	myform.xeopt.focus();
	return false;
    }
    if (ov != "") item += ','+ov;
    opts = myform.optfield;
    if (opts.value!="" && !opts.value.match(/[\n\r]$/)) item = "\n"+item;
    opts.value += item;
    myform.xelab.value = ""; // clear old value
    myform.xeopt.value = "";
    return false; // always return false
}
function xoopsFormValidate_evform() {
    myform = window.document.evform;
<{foreach from=$check key=name item=msg}>
if ( myform.<{$name}>.value == "" ) { window.alert("<{$msg}>"); myform.<{$name}>.focus(); return false; }
<{/foreach}>
return true;

}

function toggle(id,a) {
    xoopsGetElementById(id).style.display = a.checked?"block":"none";
}
toggle("exdate", xoopsGetElementById("dateck"));
toggle("optvars", xoopsGetElementById("optck"));
//--></script>
</div>
